package myJs.myPkg

import jsext._

import scala.scalajs.js
import scala.language.implicitConversions
import scala.scalajs.js.JSConverters._
import jquery.JQuery
import myJs.myPkg.d3.Selection
import org.scalajs.dom
import org.scalajs.dom.Node

import scala.scalajs.js.Dynamic.{global => g}
import scala.scalajs.js.{UndefOr, |}
import scala.scalajs.js.annotation.{JSImport, JSName}

/**
 * Created by yz on 2019/3/14
 */

@js.native
trait Phylotree extends js.Object {

  def svg(svg_element: Selection[dom.EventTarget]): Phylotree = js.native

  def radial(attr: Boolean): Phylotree = js.native

  def align_tips(attr: Boolean): Phylotree = js.native

  def radial(): Boolean = js.native

  def spacing_x(attr: Int, skip_render: Boolean): Phylotree = js.native

  def spacing_x(attr: Int): Phylotree = js.native

  def spacing_x(): Int = js.native

  def spacing_y(attr: Int, skip_render: Boolean): Phylotree = js.native

  def spacing_y(attr: Int): Phylotree = js.native

  def spacing_y(): Int = js.native

  def apply(nwk: String): Phylotree = js.native

  def layout(): Phylotree = js.native

  def size(attr: js.Array[Double]): Phylotree = js.native

  def options(options: PhylotreeOptions, runUpdate: Boolean): Phylotree = js.native

  def update(): Phylotree = js.native

  def traverse_and_compute(callback: js.Function): Phylotree = js.native

  def resort_children(comparator: js.Function): Phylotree = js.native

  def placenodes(): Phylotree = js.native

}


object PhylotreeOptions extends PhylotreeOptionsBuilder(noOpts)

class PhylotreeOptionsBuilder(val dict: OptMap) extends JSOptionBuilder[PhylotreeOptions, PhylotreeOptionsBuilder](new PhylotreeOptionsBuilder(_)) {

  def `left-right-spacing`(v: String) = jsOpt("left-right-spacing", v)

}

trait PhylotreeOptions extends js.Object {

}

@js.native
trait PhyTreeNode extends js.Object {

  def children: js.Array[PhyTreeNode] = js.native

  def count: js.Any = js.native

  def id: js.Any = js.native

  var count_depth: Int = js.native

  def x: js.Any = js.native

  def y: js.Any = js.native

  def original_child_order: Int = js.native


}


object Phylotree {

  def apply() = {
    g.d3.layout.phylotree().asInstanceOf[Phylotree]
  }

}
